<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set value="${pageContext.request.contextPath}" var="path"></c:set>
<header class="header">
    <!--电脑商城logo-->
    <div class="row">
        <div class="col-md-3">
            <a href="/computershop/web/index">
                <img src="/computershop/static/web/images/index/stumalllogo.png" />
            </a>
        </div>
        <!--快捷选项-->
        <div class="col-md-9 top-item">
            <ul class="list-inline pull-right">
                <li><a href="/computershop/web/favorites?uid=${sessionScope.loginUser.id}"><span class="fa fa-heart"></span>&nbsp;收藏</a></li>
                <li class="li-split">|</li>
                <li><a href="orders.html"><span class="fa fa-file-text"></span>&nbsp;订单</a></li>
                <li class="li-split">|</li>
                <li><a href="/computershop/web/cart?id=0"><span class="fa fa-cart-plus"></span>&nbsp;购物车</a></li>
                <li class="li-split">|</li>
                <c:choose>
                    <c:when test="${empty sessionScope.loginUser}">s
                        <li><a href="${pageContext.request.contextPath}/web/login"><span class="fa fa-user"></span>&nbsp;登录</a></li>
                    </c:when>
                    <c:otherwise>
                        <li>
                            <div class="btn-group">
                                <button type="button" class="btn btn-link dropdown-toggle" data-toggle="dropdown">
                            <span id="top-dropdown-btn">
                                <span class="fa fa-user"></span>&nbsp;${sessionScope.loginUser.username}
                                <span class="caret"></span>
                            </span>
                                </button>
                                <ul class="dropdown-menu top-dropdown-ul" role="menu">
                                    <li><a href="password.html">修改密码</a></li>
                                    <li><a href="userdata.html">个人资料</a></li>
                                    <li><a href="upload.html">上传头像</a></li>
                                    <li><a href="address.html">收货管理</a></li>
                                </ul>
                            </div>
                        </li>
                        <li class="li-split">|</li>
                        <li><a href="${pageContext.request.contextPath}/web/logout"><span class="fa fa-sign-out"></span>&nbsp;退出</a></li>
                    </c:otherwise>
                </c:choose>
            </ul>
        </div>
    </div>
</header>
<!--导航 -->
<!--分割导航和顶部-->
<div class="row top-nav">
    <div class="col-md-6">
        <ul class="nav nav-pills">
            <li>
                <a href="#"></a>
            </li>
            <li class="active"><a href="/computershop/web/index"><span class="fa fa-home"></span></a></li>
            
            <c:forEach items="${sessionScope.cateGoryList}" var="cateGory">
                <li><a href="/computershop/Web/showProduct?productType=${cateGory.id}">${cateGory.name}</a></li>
            </c:forEach>
        </ul>
    </div>
    <div class="col-md-6">
        <form action="/computershop/web/search" class="form-inline pull-right" role="form">
            <div class="form-group">
                <input type="text" class="form-control" id="search" name="search" placeholder="请输入商品名称进行搜索">
            </div>
            <button type="submit" class="btn btn-default btn-sm"><span class="fa fa-search"></span></button>
        </form>
    </div>
</div>
<!--头部结束-->
<!--导航结束-->
<script>
    $(function (){
        getCartProductNum();

    });
    function getCartProductNum()
    {
        $.ajax({
            url:"/computershop/web/cartProductNum",
            success:function (mes){
                $("#cart_product_num").text(Number(mes));
            }
        })
    }
</script>